from selenium import webdriver
import time
import os

# browser = webdriver.Firefox()

# 加启动配置
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('disable-infobars')
# chrome_options.add_argument('no-sandbox')
#
# chrome_options.add_argument('disable-dev-shm-usage')
# chrome_options.add_argument('disable-infobars')
# chromedriver = "/snap/chromium/1589/usr/lib/chromium-browser/chromedriver"
# os.environ["webdriver.chrome.driver"] = chromedriver
# 打开chrome浏览器
browser=webdriver.Chrome(chrome_options=chrome_options)

browser.get("http://www.baidu.com")
print(browser.title)  # 把页面title 打印出来
time.sleep(0.3)  #休眠0.3秒browser.find_element_by_id("kw").send_keys("selenium")
browser.find_element_by_id("kw").send_keys("selenium")
browser.find_element_by_id("su").click()
time.sleep(3)  # 休眠3秒browser.quit()

browser.quit()